<?php
Zend_Loader::loadClass('Application_Form');
Zend_Loader::loadClass('Application_Form_Element_GoogleCoordPanel');
Zend_Loader::loadClass('Application_Form_Element_SiteTerrainTemps');

class Application_Form_Preprocessor extends Application_Form
{
	protected $_formDecorators = array(
		'FormElements',
		array('Form', array('class' => 'form uniformForm'))
	);

	/*
	<div class="grid-24">
		<div class="widget">
			<div class="widget-header">
				<span class="icon-layers"></span>
				<h3>Impostazioni generali</h3>
			</div>
			<div class="widget-content">
				<p>
				</p>
			</div>
		</div>
	</div><!-- .grid -->	
	*/
	
	protected $_displaygroupDecorators = array(
			array(array('<div class="widget-header"> (open)' => 'HtmlTag'), array('tag' => 'div', 'class' => 'widget-header', 'openOnly' => true)),
			array(array('<span>' => 'HtmlTag'), array('tag' => 'span', 'class' => 'icon-layers', 'placement' => 'APPEND')),
			array('Description', array('tag' => 'h3', 'placement' => 'APPEND', 'class' => '')),
			array(array('<div class="widget-header"> (close)' => 'HtmlTag'), array('tag' => 'div', 'closeOnly' => true)),
			array(array('<div class="widget-content"> (open)' => 'HtmlTag'), array('tag' => 'div', 'class' => 'widget-content', 'openOnly' => true, 'placement' => 'APPEND')),
			'FormElements',
			array(array('<div class="widget-content"> (close)' => 'HtmlTag'), array('tag' => 'div', 'closeOnly' => true, 'placement' => 'APPEND')),
			array(array('<div class="widget">' => 'HtmlTag'), array('tag' => 'div', 'class' => 'widget')),
			//array(array('<div class="grid-24">' => 'HtmlTag'), array('tag' => 'div', 'class' => 'grid-20')),
	);

	/*
	<div class="field-group">
		<label>Nome simulazione:</label>
		<div class="field">
			<input id="xmp" type="text" placeholder="Inserire un nome per la simulazione" />
			<label for="xmp">Lorem ipsum sit dolorem quam</label>
		</div>
	</div>
	*/	
	
	protected $_elementDecorators = array(
			'viewHelper',
			array('Description', array('tag' => 'label', 'placement' => 'APPEND')),
			array(array('<div class="field">' => 'HtmlTag'), array('tag' => 'div', 'class' => 'field')),
			array('Label', array('tagClass' => '')),
			array(array('<div class="field-group">' => 'HtmlTag'), array('tag' => 'div', 'class' => 'field-group box')),
	);
	
	public function __construct() {
		parent::__construct();
		//$this->addJavascript("/dataTables/jquery.dataTables.min.js");
		//$this->addStylesheet("/dataTables/jquery.dataTables.css");
		//$this->addStylesheet("/dataTables/demo_table_jui.css");
		//$this->addStylesheet("/dataTables/fix.css");
	}
	
	public function run()
	{
		$this->_form->setAction('form/index')
		->setMethod('post')
		->setDecorators($this->_formDecorators)
		->addPrefixPath('Application_Form_Element', 'Application' . DS . 'Form' . DS . 'Element', Zend_Form::ELEMENT)
		->setOptions(array(
			'id' => "sim_form"
		));

		// DATI GENERALI DI SIMULAZIONE

		// Nome simulazione
		$sim_name = new Zend_Form_Element_Text('sim_name');
		$sim_name->setLabel('Nome simulazione')
		->setOptions(array(
			'id' => 'sim_name'
		));

		// Descrizione simulazione
		$sim_descr = new Zend_Form_Element_Textarea('sim_descr');
		$sim_descr->setLabel('Descrizione della simulazione')
		->setOptions (array(
			'cols' => '40',
			'rows' =>'8',
			'id' => 'sim_descr'
		));

		// Timestep
		$sim_timestep = new Zend_Form_Element_Select('sim_timestep');
		$sim_timestep->setLabel("Timesteps")
		->setMultiOptions(array(
			 '1' =>  '1 (1 x 60 min)',
			 '2' =>  '2 (2 x 30 min)',
			 '3' =>  '3 (3 x 20 min)',
			 '4' =>  '4 (4 x 15 min)',
			 '5' =>  '5 (5 x 12 min)',
			 '6' =>  '6 (6 x 10 min)',
			'10' => '10 (10 x 6 min)',
			'12' => '12 (12 x 5 min)',
			'15' => '15 (15 x 4 min)',
			'20' => '20 (20 x 3 min)',
			'30' => '30 (30 x 2 min)',
			'60' => '60 (60 x 1 min)'
		))
		->setOptions(array(
			'id' => 'sim_timestep',
			'value' => '4'
		));

		// Radiazione solare
		$sim_solar_distr = new Zend_Form_Element_Select('sim_solar_distr');
		$sim_solar_distr->setLabel('Modello della radiazione solare')
		->setMultiOptions(array(
			'MinimalShadowing' => 'Esterna, ignora ombreggiamento',
			'FullExterior' => 'Esterna, con ombreggiamento',
			'FullInteriorAndExterior' => 'Esterna ed interna'
		))
		->setOptions(array(
			'id' => 'sim_solar_distr',
			'value' => 'MinimalShadowing'
		));

		// Campionamento ombre
		$sim_shadow_period = new Zend_Form_Element_Text('sim_shadow_period');
		$sim_shadow_period->setLabel("Periodo campionamento zone d'ombra (giorni)")
		->setOptions(array(
			'id' => 'sim_shadow_period',
			'value' => '20'
		));

		// Algoritmo di clipping per le ombre
		$sim_shadow_alg = new Zend_Form_Element_Select('sim_shadow_alg');
		$sim_shadow_alg->setLabel("Tipologia superfici")
		->setMultiOptions(array(
			'ConvexWeilerAtherton' => 'Generalmente convesse',
			'SutherlandHodgman' => 'Generalmente non convesse'
		))
		->setOptions(array(
			'id' => 'sim_shadow_alg',
			'value' => 'SutherlandHodgman'
		));

		// Periodo simulazione
		$sim_start = new Zend_Form_Element_Text('sim_start');
		$sim_start->setLabel("Data inizio simulazione")
		->setOptions(array(
			'id' => 'sim_start',
			'value' => "01/01"
		));
		$sim_end = new Zend_Form_Element_Text('sim_end');
		$sim_end->setLabel("Data fine simulazione")
		->setOptions(array(
				'id' => 'sim_end',
				'value' => "31/12"
		));
		
		// Display group
		$this->_form->addElement($sim_name);
		$this->_form->addElement($sim_descr);
		$this->_form->addElement($sim_timestep);
		$this->_form->addElement($sim_solar_distr);
		$this->_form->addElement($sim_shadow_period);
		$this->_form->addElement($sim_shadow_alg);
		$this->_form->addElement($sim_start);
		$this->_form->addElement($sim_end);
		$this->_form->addDisplayGroup(array( 'sim_name', 'sim_descr', 'sim_timestep', 'sim_solar_distr',
			'sim_shadow_period', 'sim_shadow_alg', 'sim_start', 'sim_end'), 'group_sim');
		$ds = $this->_form->getDisplayGroup('group_sim')
		->setDescription('Impostazioni generali')
		->setDecorators($this->_displaygroupDecorators)
		->addDecorators(array(
			array('HtmlTag', array('tag' => 'div', 'id' => 'liv_1_1', 'class' => "grid-20")),
		));

		// DATI GEOGRAFICI

		// Coordinate
		$this->_form->addElement('GoogleCoordPanel', 'geo_loc');

		// Direzione nord geografico
		$geo_north = new Zend_Form_Element_Text('geo_north');
		$geo_north->setLabel("Direzione del nord geografico")
		->setOptions(array(
			'id' => 'geo_north'
		));
		$this->_form->addElement($geo_north); 

		// Display group
		$this->_form->addElement($geo_north);
		$this->_form->addDisplayGroup(array('geo_loc', 'geo_north'), 'group_site_geo');
		$ds = $this->_form->getDisplayGroup('group_site_geo')
		->setDescription('Dati geografici')
		->setDecorators($this->_displaygroupDecorators)
		->addDecorators(array(
			array('HtmlTag', array('tag' => 'div', 'id' => 'liv_2_1', 'class' => "grid-20")),
		));

		// DATI GEOMORFOLOGICI

		// Altezza slm
		$geo_elevation = new Zend_Form_Element_Text('geo_elevation');
		$geo_elevation->setLabel("Altezza sopra il livello del mare")
		->setOptions(array(
			'id' => 'geo_elevation'
		));

		// Esposizione al vento
		$geo_exposure = new Zend_Form_Element_Select('geo_exposure');
		$geo_exposure->setLabel("Esposizione al vento")
		->setOptions(array(
			'id' => 'geo_exposure'
		));

		// Natura del sito
		$geo_terrain = new Zend_Form_Element_Select('geo_terrain');
		$geo_terrain->setLabel("Natura del sito")
		->setMultiOptions(array(
			'Country' => 'Aperta campagna, pianeggiante',
			'Suburbs' => 'Boschivo, irregolare, borgata',
			'City' => 'Cittadina, centro o periferia',
			'Ocean' => 'Costa pianeggiante, baia',
			'Urban' => 'Tessuto urbano, industriale, boschivo'
		))
		->setOptions(array(
			'id' => 'geo_terrain',
			'value' => 'Suburbs'
		));
				
		// Display group
		$this->_form->addElement($geo_elevation);
		$this->_form->addElement($geo_terrain);
		$this->_form->addDisplayGroup(array('geo_elevation', 'geo_terrain'), 'group_site_geomorph');
		$ds = $this->_form->getDisplayGroup('group_site_geomorph')
		->setDescription('Dati geomorfologici')
		->setDecorators($this->_displaygroupDecorators)
		->addDecorators(array(
			array('HtmlTag', array('tag' => 'div', 'id' => 'liv_2_2', 'class' => "grid-20")),
		));

		// TERRENO

		// Riflessione solare
		$terrain_reflection_sun = new Zend_Form_Element_Text('terrain_reflection_sun');
		$terrain_reflection_sun->setLabel("Riflessione solare della superficie")
		->setOptions(array(
			'id' => 'terrain_reflection_sun'
		));
		// Riflessione per neve
		$terrain_reflection_snow = new Zend_Form_Element_Text('terrain_reflection_snow');
		$terrain_reflection_snow->setLabel("Riflessione luce per presenza di neve")
		->setOptions(array(
			'id' => 'terrain_reflection_snow'
		));
		// Riflessione diurna per neve 
		$terrain_reflection_ssnow = new Zend_Form_Element_Text('terrain_reflection_ssnow');
		$terrain_reflection_ssnow->setLabel("Riflessione luce diurna per presenza di neve")
		->setOptions(array(
			'id' => 'terrain_reflection_ssnow'
		));
		// Temperature mensili
		$this->addStylesheet('/application/form/element/siteterraintemps.css');
		$this->_form->addElement('SiteTerrainTemps', 'terrain_temps');

		// Display group
		$this->_form->addElement($terrain_reflection_sun);
		$this->_form->addElement($terrain_reflection_snow);
		$this->_form->addElement($terrain_reflection_ssnow);
		$this->_form->addDisplayGroup(array('terrain_reflection_sun' , 'terrain_reflection_snow',
			'terrain_reflection_ssnow', 'terrain_temps'), 'group_site_terrain');
		$ds = $this->_form->getDisplayGroup('group_site_terrain')
		->setDescription('Dati del terreno')
		->setDecorators($this->_displaygroupDecorators)
		->addDecorators(array(
			array('HtmlTag', array('tag' => 'div', 'id' => 'liv_2_2_1', 'class' => "grid-20")),
		));

		// PRECIPITAZIONI
		
		// annue di progetto
		$rain_design_yearly = new Zend_Form_Element_Text('rain_design_yearly');
		$rain_design_yearly->setLabel("Precipitazioni annue di progetto (m)")
		->setOptions(array(
			'id' => 'rain_design_yearly'
		));
		// annuali nominali
		$rain_nominal_yearly = new Zend_Form_Element_Text('rain_nominal_yearly');
		$rain_nominal_yearly->setLabel("Precipitazioni annuali nominali (m)")
		->setOptions(array(
			'id' => 'rain_nominal_yearly'
		));

		// Display group
		$this->_form->addElement($rain_design_yearly);
		$this->_form->addElement($rain_nominal_yearly);
		$this->_form->addDisplayGroup(array('rain_design_yearly', 'rain_nominal_yearly'), 'group_site_rain');
		$ds = $this->_form->getDisplayGroup('group_site_rain')
		->setDescription('Dati sulle precipitazioni')
		->setDecorators($this->_displaygroupDecorators)
		->addDecorators(array(
				array('HtmlTag', array('tag' => 'div', 'id' => 'liv_2_2_2', 'class' => "grid-20")),
		));

		// TIMEZONE

		// fuso orario
		$tz_timezone = new Zend_Form_Element_Select('tz_timezone');
		$tz_timezone->setLabel('Fuso orario')
		->setMultiOptions(array(
			'12' => 'GMT +12:00',
			'11' => 'GMT +11:00',
			'10' => 'GMT +10:00',
			'9' => 'GMT +9:00',
			'8' => 'GMT +8:00',
			'7' => 'GMT +7:00',
			'6' => 'GMT +6:00',
			'5' => 'GMT +5:00',
			'4' => 'GMT +4:00',
			'3' => 'GMT +3:00',
			'2' => 'GMT +2:00',
			'1' => 'GMT +1:00',
			'0' => 'GMT +0:00',
			'-1' => 'GMT -01:00',
			'-2' => 'GMT -02:00',
			'-3' => 'GMT -03:00',
			'-4' => 'GMT -04:00',
			'-5' => 'GMT -05:00',
			'-6' => 'GMT -06:00',
			'-7' => 'GMT -07:00',
			'-8' => 'GMT -08:00',
			'-9' => 'GMT -09:00',
			'-10' => 'GMT -10:00',
			'-11' => 'GMT -11:00',
			'-12' => 'GMT -12:00',
			'-13' => 'GMT -13:00'
		))
		->setOptions(array(
			'id' => 'tz_timezone',
			'value' => '1'
		));

		// Stagioni
		$tz_winter_start = new Zend_Form_Element_Text('tz_winter_start');
		$tz_winter_start->setLabel("Inizio dell'inverno")
		->setOptions(array(
			'id' => 'tz_winter_start'
		));
		$tz_winter_end = new Zend_Form_Element_Text('tz_winter_end');
		$tz_winter_end->setLabel("Fine dell'inverno")
		->setOptions(array(
			'id' => 'tz_winter_end'
		));
		$tz_summer_start = new Zend_Form_Element_Text('tz_summer_start');
		$tz_summer_start->setLabel("Inizio dell'estate")
		->setOptions(array(
			'id' => 'tz_summer_start'
		));
		$tz_summer_end = new Zend_Form_Element_Text('tz_summer_end');
		$tz_summer_end->setLabel("Fine dell'estate")
		->setOptions(array(
			'id' => 'tz_summer_end'
		));

		// Display group
		$this->_form->addElement($tz_timezone);
		$this->_form->addElement($tz_winter_start);
		$this->_form->addElement($tz_winter_end);
		$this->_form->addElement($tz_summer_start);
		$this->_form->addElement($tz_summer_end);
		$this->_form->addDisplayGroup(array('tz_timezone', 'tz_winter_start', 'tz_winter_end', 
			'tz_summer_start', 'tz_summer_end'), 'group_site_tz');
		$ds = $this->_form->getDisplayGroup('group_site_tz')
		->setDescription('Dati internazionali')
		->setDecorators($this->_displaygroupDecorators)
		->addDecorators(array(
				array('HtmlTag', array('tag' => 'div', 'id' => 'liv_2_3', 'class' => "grid-20")),
		));

		// DATI CLIMATICI

		$climazone = new Zend_Form_Element_Select('climazone');
		$climazone->setLabel('Template zona climatica')
		->setMultiOptions(array(
			'1' => 'Roma/Fiumicino'
		))
		->setOptions(array(
			'id' => 'climazone',
			'value' => '1'
		));

		// Display group
		$this->_form->addElement($climazone);
		$this->_form->addDisplayGroup(array('climazone'), 'group_site_climazone');
		$ds = $this->_form->getDisplayGroup('group_site_climazone')
		->setDescription('Dati climatici')
		->setDecorators($this->_displaygroupDecorators)
		->addDecorators(array(
				array('HtmlTag', array('tag' => 'div', 'id' => 'liv_2_4', 'class' => "grid-20")),
		));

		// EDIFICIO: DETTAGLI PROGETTO

		// Settore
		$project_sector = new Zend_Form_Element_Select('project_sector');
		$project_sector->setLabel("Categoria (D.P.R. 412/93):")
		->setMultioptions(array(
			'0' => 'Seleziona',
			'1' => 'E.1(1) collegi, case di pena, conventi e caserme',
			'2' => 'E.1(1) esclusi collegi, case di pena, conventi e caserme',
			'3' => 'E.1(2)',
			'4' => 'E.1(3)',
			'5' => 'E.2',
			'6' => 'E.3',
			'7' => 'E.4(1)',
			'8' => 'E.4(2)',
			'9'	=> 'E.4(3)',
			'10'=> 'E.5',
			'11'=> 'E.6(1)',
			'12'=> 'E.6(2)',
			'13'=> 'E.6(3)',
			'14'=> 'E.7',
			'15'=> 'E.8'
		))
		->setOptions(array
			('id' => 'project_sector')
		);
		// Nome del progetto
		$project_name = new Zend_Form_Element_Text('project_name');
		$project_name->setLabel("Nome del progetto")
		->setOptions(array(
			'id' => 'project_name'
		));
		// Indirizzo
		$project_address = new Zend_Form_Element_Textarea('project_address');
		$project_address->setLabel("Indirizzo")
		->setOptions(array(
			'id' => 'project_address',
			'rows' => 4
		));
		// Città
		$project_city = new Zend_Form_Element_Text('project_city');
		$project_city->setLabel("Città")
		->setOptions(array(
			'id' => 'project_city'
		));
		// CAP
		$project_zip = new Zend_Form_Element_Text('project_zip');
		$project_zip->setLabel("CAP / ZIP")
		->setOptions(array(
			'id' => 'project_zip'
		));

		// Display group
		$this->_form->addElement($project_sector);
		$this->_form->addElement($project_name);
		$this->_form->addElement($project_address);
		$this->_form->addElement($project_city);
		$this->_form->addElement($project_zip);
		$this->_form->addDisplayGroup(array('project_sector', 'project_name', 'project_city',
			'project_address', 'project_zip'), 'group_building_project');
		$ds = $this->_form->getDisplayGroup('group_building_project')
		->setDescription('Dettagli del progetto')
		->setDecorators($this->_displaygroupDecorators)
		->addDecorators(array(
				array('HtmlTag', array('tag' => 'div', 'id' => 'liv_3_1', 'class' => "grid-20")),
		));

		// EDIFICIO: DETTAGLI TECNICO ABILITATO

		// Nome
		$engineer_name = new Zend_Form_Element_Text('engineer_name');
		$engineer_name->setLabel("Nome")
		->setOptions(array(
			'id' => 'engineer_name'
		));
		// Telefono
		$engineer_phone = new Zend_Form_Element_Text('engineer_phone');
		$engineer_phone->setLabel("Telefono")
		->setOptions(array(
			'id' => 'engineer_phone'
		));
		// Indirizzo
		$engineer_address = new Zend_Form_Element_Text('engineer_address');
		$engineer_address->setLabel("Indirizzo")
		->setOptions(array(
			'id' => 'engineer_address'
		));
		// Città
		$engineer_city = new Zend_Form_Element_Text('engineer_city');
		$engineer_city->setLabel("Città")
		->setOptions(array(
			'id' => 'engineer_city'
		));
		// CAP
		$engineer_zip = new Zend_Form_Element_Text('engineer_zip');
		$engineer_zip->setLabel("CAP / ZIP")
		->setOptions(array(
			'id' => 'engineer_zip'
		));

		// Display group
		$this->_form->addElement($engineer_name);
		$this->_form->addElement($engineer_phone);
		$this->_form->addElement($engineer_address);
		$this->_form->addElement($engineer_city);
		$this->_form->addElement($engineer_zip);
		$this->_form->addDisplayGroup(array('engineer_name', 'engineer_phone', 'engineer_city',
			'engineer_address', 'engineer_zip'), 'group_building_engineer');
		$ds = $this->_form->getDisplayGroup('group_building_engineer')
		->setDescription('Dettagli del tecnico abilitato')
		->setDecorators($this->_displaygroupDecorators)
		->addDecorators(array(
				array('HtmlTag', array('tag' => 'div', 'id' => 'liv_3_2', 'class' => "grid-20")),
		));

		// EDIFICIO: DETTAGLI PROPRIETARIO

		// Nome
		$owner_name = new Zend_Form_Element_Text('owner_name');
		$owner_name->setLabel("Nome")
		->setOptions(array(
			'id' => 'owner_name'
		));
		// Telefono
		$owner_phone = new Zend_Form_Element_Text('owner_phone');
		$owner_phone->setLabel("Telefono")
		->setOptions(array(
			'id' => 'owner_phone'
		));
		// Indirizzo
		$owner_address = new Zend_Form_Element_Text('owner_address');
		$owner_address->setLabel("Indirizzo")
		->setOptions(array(
			'id' => 'owner_address'
		));
		// Città
		$owner_city = new Zend_Form_Element_Text('owner_city');
		$owner_city->setLabel("Città")
		->setOptions(array(
			'id' => 'owner_city'
		));
		// CAP
		$owner_zip = new Zend_Form_Element_Text('owner_zip');
		$owner_zip->setLabel("CAP / ZIP")
		->setOptions(array(
			'id' => 'owner_zip'
		));
		
		// Display group
		$this->_form->addElement($owner_name);
		$this->_form->addElement($owner_phone);
		$this->_form->addElement($owner_address);
		$this->_form->addElement($owner_city);
		$this->_form->addElement($owner_zip);
		$this->_form->addDisplayGroup(array('owner_name', 'owner_phone', 'owner_city',
				'owner_address', 'owner_zip'), 'group_building_owner');
		$ds = $this->_form->getDisplayGroup('group_building_owner')
		->setDescription('Dettagli del proprietario')
		->setDecorators($this->_displaygroupDecorators)
		->addDecorators(array(
				array('HtmlTag', array('tag' => 'div', 'id' => 'liv_3_3', 'class' => "grid-20")),
		));
		
		// ZONA: GEOMETRIA
		
		// Lunghezza
		$geometry_length = new Zend_Form_Element_Text('geometry_length');
		$geometry_length->setLabel("Lunghezza")
		->setOptions(array(
				'id' => 'geometry_length'
		));
		// Larghezza/profondità
		$geometry_depth = new Zend_Form_Element_Text('geometry_depth');
		$geometry_depth->setLabel("Profondità")
		->setOptions(array(
				'id' => 'geometry_depth'
		));
		// Altezza
		$geometry_height = new Zend_Form_Element_Text('geometry_height');
		$geometry_height->setLabel("Altezza")
		->setOptions(array(
				'id' => 'geometry_height'
		));
		// Piano
		$geometry_storey = new Zend_Form_Element_Select('geometry_storey');
		$geometry_storey->setLabel("Piano")
		->setMultioptions(array(
			'R' => 'Ultimo piano',
			'I' => 'Piano intermedio',
			'G' => 'Piano terra/seminterrato'
		))
		->setOptions(array(
				'id' => 'geometry_storey'
		));
		// Schema geometrico
		$this->addJavascript('/application/form/element/geometry_schema.js');
		$this->addStylesheet('/application/form/element/geometry_schema.css');
		$this->_form->addElement('BuildingGeometry', 'geometry_schema');
		
		// Display group
		$this->_form->addElement($geometry_length);
		$this->_form->addElement($geometry_depth);
		$this->_form->addElement($geometry_height);
		$this->_form->addElement($geometry_storey);
		$this->_form->addDisplayGroup(array('geometry_length', 'geometry_depth', 'geometry_height',
			'geometry_storey', 'geometry_schema'), 'group_building_geometry');
		$ds = $this->_form->getDisplayGroup('group_building_geometry')
		->setDescription('Dati geometrici')
		->setDecorators($this->_displaygroupDecorators)
		->addDecorators(array(
			array('HtmlTag', array('tag' => 'div', 'id' => 'liv_4_1', 'class' => "grid-20")),
		));

		// ZONA: PARETI
		
		// Parete nord
		$wall_north = new Zend_Form_Element_Text('wall_north_name');
		$wall_north->setLabel("Parete nord")
		->setDescription("La parete è trattata come una struttura adiabatica")
		->setAttrib('placeholder', 'Seleziona una struttura opaca')
		->setOptions(array(
			'id' => 'wall_north'
		));
		$wall_north_id = new Zend_Form_Element_Hidden('wall_north_id');
		$wall_north_id->clearDecorators()
		->setOptions(array(
			'id' => 'wall_north_id'
		));
		// Parete ovest
		$wall_west = new Zend_Form_Element_Text('wall_west_name');
		$wall_west->setLabel("Parete ovest")
		->setDescription("La parete è trattata come una struttura adiabatica")
		->setAttrib('placeholder', 'Seleziona una struttura opaca')
		->setOptions(array(
			'id' => 'wall_west'
		));
		$wall_west_id = new Zend_Form_Element_Hidden('wall_west_id');
		$wall_west_id->setOptions(array(
			'id' => 'wall_west_id'
		));
		// Parete sud
		$wall_south = new Zend_Form_Element_Text('wall_south_name');
		$wall_south->setLabel("Parete sud")
		->setDescription("La parete è trattata come una struttura adiabatica")
		->setAttrib('placeholder', 'Seleziona una struttura opaca')
		->setOptions(array(
			'id' => 'wall_south'
		));
		$wall_south_id = new Zend_Form_Element_Hidden('wall_south_id');
		$wall_south_id->setOptions(array(
			'id' => 'wall_south_id'
		));
		// Parete est
		$wall_east = new Zend_Form_Element_Text('wall_east_name');
		$wall_east->setLabel("Parete est")
		->setDescription("La parete è trattata come una struttura adiabatica")
		->setAttrib('placeholder', 'Seleziona una struttura opaca')
		->setOptions(array(
			'id' => 'wall_east'
		));
		$wall_east_id = new Zend_Form_Element_Hidden('wall_east_id');
		$wall_east_id->setOptions(array(
			'id' => 'wall_east_id'
		));
		
		// Display group
		$this->_form->addElement($wall_north);
		$this->_form->addElement($wall_west);
		$this->_form->addElement($wall_south);
		$this->_form->addElement($wall_east);
		$this->_form->addElement($wall_north_id);
		$this->_form->addElement($wall_west_id);
		$this->_form->addElement($wall_south_id);
		$this->_form->addElement($wall_east_id);
		
		$this->_form->addDisplayGroup(array('wall_north_name', 'wall_west_name', 'wall_south_name', 'wall_east_name',
			'wall_north_id', 'wall_west_id', 'wall_south_id', 'wall_east_id'), 'group_building_walls');
		$ds = $this->_form->getDisplayGroup('group_building_walls')
		->setDescription('Pareti')
		->setDecorators($this->_displaygroupDecorators)
		->addDecorators(array(
				array('HtmlTag', array('tag' => 'div', 'id' => 'liv_4_2', 'class' => "grid-20")),
		));

		// EDIFICIO: PORTE
		
		// Porte nord
		$door_north = new Zend_Form_Element_Text('door_north_name');
		$door_north->setLabel("Porte lato nord")
		->setAttrib('placeholder', 'Seleziona una struttura opaca')
		->setOptions(array(
			'id' => 'door_north'
		));
		$door_north_id = new Zend_Form_Element_Hidden('door_north_id');
		$door_north_id->clearDecorators()
		->setOptions(array(
			'id' => 'door_north_id'
		));
		$door_north_length = new Zend_Form_Element_Text('door_north_length');
		$door_north_length->setLabel("Lunghezza porte lato nord")
		->setOptions(array(
			'id' => 'door_north_length'
		));
		$door_north_height = new Zend_Form_Element_Text('door_north_height');
		$door_north_height->setLabel("Altezza porte lato nord")
		->setOptions(array(
			'id' => 'door_north_height'
		));
		$door_north_elev = new Zend_Form_Element_Text('door_north_elev');
		$door_north_elev->setLabel("Altezza dal pavimento porte lato nord")
		->setOptions(array(
			'id' => 'door_north_elev'
		));
		$door_north_num = new Zend_Form_Element_Text('door_north_num');
		$door_north_num->setLabel("Numero porte lato nord")
		->setDescription("Viene considerata una distribuzione omogenea delle porte lungo la parete")
		->setOptions(array(
			'id' => 'door_north_num'
		));
		
		// Porte est
		$door_east = new Zend_Form_Element_Text('door_east_name');
		$door_east->setLabel("Porte lato est")
		->setAttrib('placeholder', 'Seleziona una struttura opaca')
		->setOptions(array(
			'id' => 'door_east'
		));
		$door_east_id = new Zend_Form_Element_Hidden('door_east_id');
		$door_east_id->clearDecorators()
		->setOptions(array(
			'id' => 'door_east_id'
		));
		$door_east_length = new Zend_Form_Element_Text('door_east_length');
		$door_east_length->setLabel("Lunghezza porte lato est")
		->setOptions(array(
			'id' => 'door_east_length'
		));
		$door_east_height = new Zend_Form_Element_Text('door_east_height');
		$door_east_height->setLabel("Altezza porte lato est")
		->setOptions(array(
			'id' => 'door_east_height'
		));
		$door_east_elev = new Zend_Form_Element_Text('door_east_elev');
		$door_east_elev->setLabel("Altezza dal pavimento porte lato est")
		->setOptions(array(
				'id' => 'door_east_elev'
		));
		$door_east_num = new Zend_Form_Element_Text('door_east_num');
		$door_east_num->setLabel("Numero porte lato est")
		->setDescription("Viene considerata una distribuzione omogenea delle porte lungo la parete")
		->setOptions(array(
			'id' => 'door_east_num'
		));
		
		// Porte sud
		$door_south = new Zend_Form_Element_Text('door_south_name');
		$door_south->setLabel("Porte lato sud")
		->setAttrib('placeholder', 'Seleziona una struttura opaca')
		->setOptions(array(
			'id' => 'door_south'
		));
		$door_south_id = new Zend_Form_Element_Hidden('door_south_id');
		$door_south_id->clearDecorators()
		->setOptions(array(
			'id' => 'door_south_id'
		));
		$door_south_length = new Zend_Form_Element_Text('door_south_length');
		$door_south_length->setLabel("Lunghezza porte lato sud")
		->setOptions(array(
			'id' => 'door_south_length'
		));
		$door_south_height = new Zend_Form_Element_Text('door_south_height');
		$door_south_height->setLabel("Altezza porte lato sud")
		->setOptions(array(
			'id' => 'door_south_height'
		));
		$door_south_elev = new Zend_Form_Element_Text('door_south_elev');
		$door_south_elev->setLabel("Altezza dal pavimento porte lato sud")
		->setOptions(array(
			'id' => 'door_south_elev'
		));
		$door_south_num = new Zend_Form_Element_Text('door_south_num');
		$door_south_num->setLabel("Numero porte lato sud")
		->setDescription("Viene considerata una distribuzione omogenea delle porte lungo la parete")
		->setOptions(array(
			'id' => 'door_south_num'
		));
		
		// Porte ovest
		$door_west = new Zend_Form_Element_Text('door_west_name');
		$door_west->setLabel("Porte lato ovest")
		->setAttrib('placeholder', 'Seleziona una struttura opaca')
		->setOptions(array(
			'id' => 'door_west'
		));
		$door_west_id = new Zend_Form_Element_Hidden('door_west_id');
		$door_west_id->clearDecorators()
		->setOptions(array(
			'id' => 'door_west_id'
		));
		$door_west_length = new Zend_Form_Element_Text('door_west_length');
		$door_west_length->setLabel("Lunghezza porte lato ovest")
		->setOptions(array(
			'id' => 'door_west_length'
		));
		$door_west_height = new Zend_Form_Element_Text('door_west_height');
		$door_west_height->setLabel("Altezza porte lato ovest")
		->setOptions(array(
			'id' => 'door_west_height'
		));
		$door_west_elev = new Zend_Form_Element_Text('door_west_elev');
		$door_west_elev->setLabel("Altezza dal pavimento porte lato ovest")
		->setOptions(array(
			'id' => 'door_west_elev'
		));
		$door_west_num = new Zend_Form_Element_Text('door_west_num');
		$door_west_num->setLabel("Numero porte lato ovest")
		->setDescription("Viene considerata una distribuzione omogenea delle porte lungo la parete")
		->setOptions(array(
			'id' => 'door_west_num'
		));
		
		// Display group
		$this->_form->addElement($door_north);
		$this->_form->addElement($door_north_id);
		$this->_form->addElement($door_north_length);
		$this->_form->addElement($door_north_height);
		$this->_form->addElement($door_north_elev);
		$this->_form->addElement($door_north_num);
		$this->_form->addElement($door_east);
		$this->_form->addElement($door_east_id);
		$this->_form->addElement($door_east_length);
		$this->_form->addElement($door_east_height);
		$this->_form->addElement($door_east_elev);
		$this->_form->addElement($door_east_num);
		$this->_form->addElement($door_south);
		$this->_form->addElement($door_south_id);
		$this->_form->addElement($door_south_length);
		$this->_form->addElement($door_south_height);
		$this->_form->addElement($door_south_elev);
		$this->_form->addElement($door_south_num);
		$this->_form->addElement($door_west);
		$this->_form->addElement($door_west_id);
		$this->_form->addElement($door_west_length);
		$this->_form->addElement($door_west_height);
		$this->_form->addElement($door_west_elev);
		$this->_form->addElement($door_west_num);
		
		$this->_form->addDisplayGroup(array('door_north_name', 'door_north_id', 'door_north_length',
			'door_north_height', 'door_north_elev', 'door_north_num',
			'door_east_name', 'door_east_id', 'door_east_length',
			'door_east_height', 'door_east_elev', 'door_east_num',
			'door_south_name', 'door_south_id', 'door_south_length',
			'door_south_height', 'door_south_elev', 'door_south_num',
			'door_west_name', 'door_west_id', 'door_west_length',
			'door_west_height', 'door_west_elev', 'door_west_num'), 'group_building_doors');
		$ds = $this->_form->getDisplayGroup('group_building_doors')
		->setDescription('Porte e strutture trasparenti')
		->setDecorators($this->_displaygroupDecorators)
		->addDecorators(array(
			array('HtmlTag', array('tag' => 'div', 'id' => 'liv_4_3', 'class' => "grid-20")),
		));
		

		// EDIFICIO: FINESTRE
		
		// Finestre nord
		$window_north = new Zend_Form_Element_Text('window_north_name');
		$window_north->setLabel("Finestre lato nord")
		->setAttrib('placeholder', 'Seleziona una struttura trasparente')
		->setOptions(array(
			'id' => 'window_north'
		));
		$window_north_id = new Zend_Form_Element_Hidden('window_north_id');
		$window_north_id->clearDecorators()
		->setOptions(array(
			'id' => 'window_north_id'
		));
		$window_north_length = new Zend_Form_Element_Text('window_north_length');
		$window_north_length->setLabel("Lunghezza finestre lato nord")
		->setOptions(array(
			'id' => 'window_north_length'
		));
		$window_north_height = new Zend_Form_Element_Text('window_north_height');
		$window_north_height->setLabel("Altezza finestre lato nord")
		->setOptions(array(
			'id' => 'window_north_height'
		));
		$window_north_elev = new Zend_Form_Element_Text('window_north_elev');
		$window_north_elev->setLabel("Altezza dal pavimento finestre lato nord")
		->setOptions(array(
			'id' => 'window_north_elev'
		));
		$window_north_num = new Zend_Form_Element_Text('window_north_num');
		$window_north_num->setLabel("Numero finestre lato nord")
		->setDescription("Viene considerata una distribuzione omogenea delle finestre lungo la parete")
		->setOptions(array(
			'id' => 'window_north_num'
		));
		
		
		// Finestre est
		$window_east = new Zend_Form_Element_Text('window_east_name');
		$window_east->setLabel("Finestre lato est")
		->setAttrib('placeholder', 'Seleziona una struttura trasparente')
		->setOptions(array(
			'id' => 'window_east'
		));
		$window_east_id = new Zend_Form_Element_Hidden('window_east_id');
		$window_east_id->clearDecorators()
		->setOptions(array(
			'id' => 'window_east_id'
		));
		$window_east_length = new Zend_Form_Element_Text('window_east_length');
		$window_east_length->setLabel("Lunghezza finestre lato est")
		->setOptions(array(
			'id' => 'window_east_length'
		));
		$window_east_height = new Zend_Form_Element_Text('window_east_height');
		$window_east_height->setLabel("Altezza finestre lato est")
		->setOptions(array(
			'id' => 'window_east_height'
		));
		$window_east_elev = new Zend_Form_Element_Text('window_east_elev');
		$window_east_elev->setLabel("Altezza dal pavimento finestre lato est")
		->setOptions(array(
			'id' => 'window_east_elev'
		));
		$window_east_num = new Zend_Form_Element_Text('window_east_num');
		$window_east_num->setLabel("Numero finestre lato est")
		->setDescription("Viene considerata una distribuzione omogenea delle finestre lungo la parete")
		->setOptions(array(
			'id' => 'window_east_num'
		));
		
		// Finestre sud
		$window_south = new Zend_Form_Element_Text('window_south_name');
		$window_south->setLabel("Finestre lato sud")
		->setAttrib('placeholder', 'Seleziona una struttura trasparente')
		->setOptions(array(
			'id' => 'window_south'
		));
		$window_south_id = new Zend_Form_Element_Hidden('window_south_id');
		$window_south_id->clearDecorators()
		->setOptions(array(
			'id' => 'window_south_id'
		));
		$window_south_length = new Zend_Form_Element_Text('window_south_length');
		$window_south_length->setLabel("Lunghezza finestre lato sud")
		->setOptions(array(
			'id' => 'window_south_length'
		));
		$window_south_height = new Zend_Form_Element_Text('window_south_height');
		$window_south_height->setLabel("Altezza finestre lato sud")
		->setOptions(array(
			'id' => 'window_south_height'
		));
		$window_south_elev = new Zend_Form_Element_Text('window_south_elev');
		$window_south_elev->setLabel("Altezza dal pavimento finestre lato sud")
		->setOptions(array(
			'id' => 'window_south_elev'
		));
		$window_south_num = new Zend_Form_Element_Text('window_south_num');
		$window_south_num->setLabel("Numero finestre lato sud")
		->setDescription("Viene considerata una distribuzione omogenea delle finestre lungo la parete")
		->setOptions(array(
			'id' => 'window_south_num'
		));
		
		// Finestre ovest
		$window_west = new Zend_Form_Element_Text('window_west_name');
		$window_west->setLabel("Finestre lato ovest")
		->setAttrib('placeholder', 'Seleziona una struttura trasparente')
		->setOptions(array(
			'id' => 'window_west'
		));
		$window_west_id = new Zend_Form_Element_Hidden('window_west_id');
		$window_west_id->clearDecorators()
		->setOptions(array(
			'id' => 'window_west_id'
		));
		$window_west_length = new Zend_Form_Element_Text('window_west_length');
		$window_west_length->setLabel("Lunghezza finestre lato ovest")
		->setOptions(array(
			'id' => 'window_west_length'
		));
		$window_west_height = new Zend_Form_Element_Text('window_west_height');
		$window_west_height->setLabel("Altezza finestre lato ovest")
		->setOptions(array(
			'id' => 'window_west_height'
		));
		$window_west_elev = new Zend_Form_Element_Text('window_west_elev');
		$window_west_elev->setLabel("Altezza dal pavimento finestre lato ovest")
		->setOptions(array(
			'id' => 'window_west_elev'
		));
		$window_west_num = new Zend_Form_Element_Text('window_west_num');
		$window_west_num->setLabel("Numero finestre lato ovest")
		->setDescription("Viene considerata una distribuzione omogenea delle finestre lungo la parete")
		->setOptions(array(
			'id' => 'window_west_num'
		));
		
		// Composizione telaio (p. 257)
		$frame_width = new Zend_Form_Element_Text('frame_width');
		$frame_width->setLabel("Spessore del telaio (totale)")
		->setOptions(array(
			'id' => 'frame_width',
			'value' => '0.05'
		));

		
		$frame_outside = new Zend_Form_Element_Text('frame_outside');
		$frame_outside->setLabel("Sporgenza del telaio all'esterno)")
		->setOptions(array(
			'id' => 'frame_outside',
			'value' => '0.04'
		));

		$frame_inside = new Zend_Form_Element_Text('frame_inside');
		$frame_inside->setLabel("Sporgenza del telaio all'interno)")
		->setOptions(array(
			'id' => 'frame_inside',
			'value' => '0.03'
		));

		$frame_conductance = new Zend_Form_Element_Text('frame_conductance');
		$frame_conductance->setLabel("Conduttanza termica del telaio")
		->setOptions(array(
			'id' => 'frame_conductance',
			'value' => '5.0'
		));

		$frame_solar_absorptance = new Zend_Form_Element_Text('frame_solar_absorptance');
		$frame_solar_absorptance->setLabel("Assorbanza solare del telaio")
		->setOptions(array(
			'id' => 'frame_solar_absorptance',
			'value' => '0.8'
		));

		$frame_visible_absorptance = new Zend_Form_Element_Text('frame_visible_absorptance');
		$frame_visible_absorptance->setLabel("Assorbanza visibile del telaio")
		->setOptions(array(
			'id' => 'frame_visible_absorptance',
			'value' => '0.8'
		));

		$frame_emissivity = new Zend_Form_Element_Text('frame_emissivity');
		$frame_emissivity->setLabel("Emittanza emisferica del telaio")
		->setOptions(array(
			'id' => 'frame_emissivity',
			'value' => '0.9'
		));

		$frame_divider = new Zend_Form_Element_Select('frame_divider');
		$frame_divider->setLabel("Tipologia divisori (se presenti)")
		->setMultioptions(array(
			'DividedLite' => 'Esterni',
			'Suspended' => 'Interni',
		))
		->setOptions(array(
			'id' => 'frame_divider',
			'value' => 'DividedLite'
		));

		$frame_divider_width = new Zend_Form_Element_Text('frame_divider_width');
		$frame_divider_width->setLabel("Larghezza dei divisori")
		->setOptions(array(
			'id' => 'frame_divider_width',
			'value' => '0.03'
		));

		$frame_divider_hnum = new Zend_Form_Element_Text('frame_divider_hnum');
		$frame_divider_hnum->setLabel("Numero dei divisori orizzontali)")
		->setOptions(array(
			'id' => 'frame_divider_hnum',
			'value' => '2'
		));

		$frame_divider_vnum = new Zend_Form_Element_Text('frame_divider_vnum');
		$frame_divider_vnum->setLabel("Numero dei divisori verticali)")
		->setOptions(array(
			'id' => 'frame_divider_vnum',
			'value' => '2'
		));

		
		$frame_divider_outside = new Zend_Form_Element_Text('frame_divider_outside');
		$frame_divider_outside->setLabel("Sporgenza divisori (all'esterno)")
		->setOptions(array(
			'id' => 'frame_divider_outside',
			'value' => '0.03'
		));

		$frame_divider_inside = new Zend_Form_Element_Text('frame_divider_inside');
		$frame_divider_inside->setLabel("Sporgenza dei divisori (all'interno)")
		->setOptions(array(
			'id' => 'frame_divider_inside',
			'value' => '0.03'
		));

		$frame_divider_conductance = new Zend_Form_Element_Text('frame_divider_conductance');
		$frame_divider_conductance->setLabel("Conduttanza dei divisori")
		->setOptions(array(
			'id' => 'frame_divider_conductance',
			'value' => '5.0'
		));

		$frame_divider_solar_absorptance = new Zend_Form_Element_Text('frame_divider_solar_absorptance');
		$frame_divider_solar_absorptance->setLabel("Assorbanza solare dei divisori")
		->setOptions(array(
			'id' => 'frame_divider_solar_absorptance',
			'value' => '0.8'
		));

		$frame_divider_visible_absorptance = new Zend_Form_Element_Text('frame_divider_visible_absorptance');
		$frame_divider_visible_absorptance->setLabel("Assorbanza visibile dei divisori")
		->setOptions(array(
			'id' => 'frame_divider_visible_absorptance',
			'value' => '0.8'
		));

		$frame_divider_emissivity = new Zend_Form_Element_Text('frame_divider_emissivity');
		$frame_divider_emissivity->setLabel("Emittanza emisferica dei divisori")
		->setOptions(array(
			'id' => 'frame_divider_emissivity',
			'value' => '0.9'
		));		

		// Display group
		$this->_form->addElement($window_north);
		$this->_form->addElement($window_north_id);
		$this->_form->addElement($window_north_length);
		$this->_form->addElement($window_north_height);
		$this->_form->addElement($window_north_elev);
		$this->_form->addElement($window_north_num);
		
		$this->_form->addElement($window_east);
		$this->_form->addElement($window_east_id);
		$this->_form->addElement($window_east_length);
		$this->_form->addElement($window_east_height);
		$this->_form->addElement($window_east_elev);
		$this->_form->addElement($window_east_num);
		
		$this->_form->addElement($window_south);
		$this->_form->addElement($window_south_id);
		$this->_form->addElement($window_south_length);
		$this->_form->addElement($window_south_height);
		$this->_form->addElement($window_south_elev);
		$this->_form->addElement($window_south_num);
		
		$this->_form->addElement($window_west);
		$this->_form->addElement($window_west_id);
		$this->_form->addElement($window_west_length);
		$this->_form->addElement($window_west_height);
		$this->_form->addElement($window_west_elev);
		$this->_form->addElement($window_west_num);

		$this->_form->addElement($frame_width);
		$this->_form->addElement($frame_outside);
		$this->_form->addElement($frame_inside);
		$this->_form->addElement($frame_conductance);
		$this->_form->addElement($frame_solar_absorptance);
		$this->_form->addElement($frame_visible_absorptance);
		$this->_form->addElement($frame_emissivity);
		
		$this->_form->addElement($frame_divider);
		$this->_form->addElement($frame_divider_width);
		$this->_form->addElement($frame_divider_hnum);
		$this->_form->addElement($frame_divider_vnum);
		$this->_form->addElement($frame_divider_outside);
		$this->_form->addElement($frame_divider_inside);
		$this->_form->addElement($frame_divider_conductance);
		$this->_form->addElement($frame_divider_solar_absorptance);
		$this->_form->addElement($frame_divider_visible_absorptance);
		
		
		$this->_form->addDisplayGroup(array('window_north_name', 'window_north_id', 'window_north_length', 
			'window_north_height', 'window_north_elev', 'window_north_num',
			'window_east_name', 'window_east_id', 'window_east_length',
			'window_east_height', 'window_east_elev', 'window_east_num',
			'window_south_name', 'window_south_id', 'window_south_length',
			'window_south_height', 'window_south_elev', 'window_south_num',
			'window_west_name', 'window_west_id', 'window_west_length',
			'window_west_height', 'window_west_elev', 'window_west_num',
			'frame_width', 'frame_outside', 'frame_inside', 'frame_conductance',
			'frame_solar_absorptance', 'frame_visible_absorptance', 'frame_emissivity',
			'frame_divider', 'frame_divider_width', 'frame_divider_hnum', 
			'frame_divider_vnum', 'frame_divider_outside', 'frame_divider_inside', 
			'frame_divider_conductance', 'frame_divider_solar_absorptance',
			'frame_divider_visible_absorptance'), 'group_building_windows');
		
		$ds = $this->_form->getDisplayGroup('group_building_windows')
		->setDescription('Finestre e strutture trasparenti')
		->setDecorators($this->_displaygroupDecorators)
		->addDecorators(array(
				array('HtmlTag', array('tag' => 'div', 'id' => 'liv_4_4', 'class' => "grid-20")),
		));

		// EDIFICIO: PAVIMENTO E SOFFITTO
		
		// Pavimento
		$floor = new Zend_Form_Element_Text('floor_name');
		$floor->setLabel("Pavimento")
		->setDescription("Il pavimento è adiacente al piano sottostante")
		->setAttrib('placeholder', 'Seleziona una struttura opaca')
		->setOptions(array(
			'id' => 'floor'
		));
		$floor_id = new Zend_Form_Element_Hidden('floor_id');
		$floor_id->clearDecorators()
		->setOptions(array(
			'id' => 'floor_id'
		));
		// Soffitto
		$ceiling = new Zend_Form_Element_Text('ceiling_name');
		$ceiling->setLabel("Soffitto")
		->setDescription("Il soffitto è adiacente al tetto")
		->setAttrib('placeholder', 'Seleziona una struttura opaca')
		->setOptions(array(
			'id' => 'ceiling'
		));
		$ceiling_id = new Zend_Form_Element_Hidden('ceiling_id');
		$ceiling_id->setOptions(array(
			'id' => 'ceiling_id'
		));
		
		// Display group
		$this->_form->addElement($floor);
		$this->_form->addElement($ceiling);
		$this->_form->addElement($floor_id);
		$this->_form->addElement($ceiling_id);
		
		$this->_form->addDisplayGroup(array('floor_name', 'ceiling_name', 'floor_id',
			'ceiling_id'), 'group_building_floors');
		$ds = $this->_form->getDisplayGroup('group_building_floors')
		->setDescription('Pavimento e soffitto')
		->setDecorators($this->_displaygroupDecorators)
		->addDecorators(array(
			array('HtmlTag', array('tag' => 'div', 'id' => 'liv_4_5', 'class' => "grid-20")),
		));
		




		// Applico decorator agli elementi
		$this->_form->setElementDecorators($this->_elementDecorators, array('geo_loc', 'terrain_temps', 'geometry_schema'), false);
		
		// Elementi hidden non devono avere decorators
		$elements = $this->_form->getElements();
		foreach ($elements as $elem) {
			if ($elem instanceof Zend_Form_Element_Hidden)
				$elem->setDecorators(array('ViewHelper'));
		}

		// Datasources (strutture opache)
		Zend_Loader::loadClass('Constructions');
		$costruzioni = new Constructions();
		$recordSet = $costruzioni->select()->from($costruzioni, array("id", "name", "id_category"))
		->where("status > ?", 0)
		->order("name");
		$this->_view->constructions = $costruzioni->fetchAll($recordSet);
		// Datasources (strutture trasparenti)
		Zend_Loader::loadClass('Glazing');
		$glazings = new Glazing();
		$recordSet = $glazings->select()->from($glazings, array("id", "name", "id_category"))
		->where("status > ?", 0)
		->order("name");
		$this->_view->glazings = $glazings->fetchAll($recordSet);
		// Datasources (categorie strutture opache)
		Zend_Loader::loadClass('ConstructionCategories');
		$categorie = new ConstructionCategories();
		$recordSet = $categorie->select()->from($categorie, array("id", "name"))
		->where("status > ?", 0)
		->order("name");
		$this->_view->construction_categories = $categorie->fetchAll($recordSet)->toArray();
		// Datasources (categorie strutture trasparenti)
		Zend_Loader::loadClass('GlazingCategories');
		$categorie = new GlazingCategories();
		$recordSet = $categorie->select()->from($categorie, array("id", "name"))
		->where("status > ?", 0)
		->order("name");
		$this->_view->glazing_categories = $categorie->fetchAll($recordSet)->toArray();
		
		// Render
		$this->_view->form = $this->_form->render($this->_view);
	}
}

